﻿using System;
class LeapYearCheck
{
    static ushort InputNumber(ushort fromValue, ushort toValue)
    {
        ushort number = 0;
        do
        {
            if (number != 0)
            {
                Console.Write("number must be between {0} and {1}. reenter: ", fromValue, toValue);
            }
            while (true)
            {
                try
                {
                    number = ushort.Parse(Console.ReadLine());
                    break;
                }
                catch (FormatException)
                {
                    Console.Write("reenter number. not in wanted format: ");
                }
                catch (OverflowException)
                {
                    Console.WriteLine("overflow");
                }
            }
        } while ((number < fromValue) || (number > toValue));
        return number;
    }
    static void Main()
    {
        Console.Write("please enter year: ");
        ushort year = InputNumber(0,5000);
        if (DateTime.IsLeapYear(year))
        {
            if (year > 2013)
            {
                Console.WriteLine("year {0} will be leap", year);
            }
            else
            {
                Console.WriteLine("year {0} was leap", year);
            }
        }
        else
        {
            if (year > 2013)
            {
                Console.WriteLine("year {0} will not be leap", year);
            }
            else
            {
                Console.WriteLine("year {0} was not leap", year);
            }
        }

        if (DateTime.IsLeapYear(DateTime.Now.Year))
        {
            Console.WriteLine("current year {0} is leap", DateTime.Now.Year);
        }
        else
        {
            Console.WriteLine("current year {0} is not leap", DateTime.Now.Year);
        }
        Console.ReadLine();
    }
}

